home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Business Master (4th Edition)
/
The Business Master - 4th Edition.iso
/
files
/
comphelp
/
babystep
/
chapt1
< prev
next >
Wrap
Text File
|
1994-02-20
|
6KB
|
194 lines
CHAPTER 1
INTRODUCTION TO BATCH (BAT) FILES
Batch File commands are the most powerful and
versatile of the DOS commands. Writing Batch Files
is the best way to learn how to use the DOS commands.
In the next lessons you will write many Batch Files.
You'll have an opportunity to see these Batch files
come alive with the Menus, Programs and color
combinations. You'll experience a sense of power
that you have over the computer.
This is a real accomplishment to learn one of
the most powerfuQl and useful parts of DOS. You'll be
one of the few persons who'll know how to write a
Batch File, a Program and a Menu---and in color.
└─ HOW TO WRITE BATCH FILES
BATCH (BAT) FILE
Bat (short for Batch File) is not a DOS command,
but a file that is created with the Copy Command. It
has special powers given to it by DOS. Bat Files can
instruct the computer (DOS)) to carry out commands.
Batch File commands can make the computer (DOS)
create Menu-Driven-Programs; automate many DOS
functions; beep; blink; change colors; show you
what's in a file; print a file, and perform many other
functions.
└─ GETTING STARTED
To do the Lessons from this disk or from the
Manual, you must first format a disk with the System
files so it will start your computer.
└─ FORMATTING A DISK
If you have only one disk drive, type the following
next to the A> prompt:
Format A:/S <Press Enter key>
The computer will instruct you on what to do.
If you have two disk drives, insert your DOS disk
into drive A. Insert a Blank disk into drive B:.
Now type the following next to the A prompt:
Format B:/S
When formatting is complete remove both disks.
Insert your formatted disk (from drive B>)
into the A> drive.
└─ THE COPY COMMAND
The most versatile DOS command is the Copy command.
With the Copy command all sorts of Batch Files can
be created. The Batch Files being a special DOS file
can give the computer all sorts of commands
-3-
from copying a file to formatting a disk.
In this lesson the interest is in writing Batch Files,
Programs and Menus. All of which the Batch File
does very well.
You'll first write a simple Batch File that will tell
the computer to show you all the files (contents) of the
directory of the disk in drive A.
Check to see that your formatted disk is in the A> disk drive.
└─ WRITING THE FIRST BATCH FILE
▀ With your formatted disk in the disk drive, type the following
next to the A:\> Prompt, like this:
Copy Con First.Bat
A:
Dir
Press F6 key, <then press Enter key>
-------------
└─ THE BAT FILE ABOVE TELLS US:
▀ That the first line contains the Copy command and
the name of the Bat file (First).
▀ The next word after Copy is "Con" which stands
for CONsole (keyboard). Con instructs the Copy command
to copy from the keyboard what you are about to write.
▀ The second line "A:" stands for the A drive. This tells
the computer that you are working with the disk in
the A drive.
▀ The third line tells the computer that you wish to see
on the screen the contents of the directory that is on
the disk in the A drive.
▀ Line four is the Function key F6 (large key on top
row) that tells the computer (DOS) that you are
finished writing the Batch File.
All that is left now is to strike the Enter key.
The Batch file will be saved on the disk in the A> drive.
Now you will write four Batch files that will be used
to change the screen color (Background) to Blue or Red and
the letters to White or Yellow. You'll then display the
files in the A: directory.
└─ WRITING THE FIRST COLOR BATCH-FILE (BB.Bat)
(BB.Bat.. Blue Screen...also called Background)
Type the following next to the A:\> Prompt, like this:
Copy Con BB.Bat
BB.Bat
Dir
Press F6 key, then press Enter key.
-------------
└─ WRITING THE SECOND COLOR BATCH-FILE (W.Bat)
(W.Bat..White letters... also called Foreground)
-4-
Type the following next to the A> Prompt, like this:
Copy Con W.Bat
W.Bat
Dir
Press F6 key, then press Enter key.
-------------
└─ WRITING THE THIRD COLOR BATCH-FILE (Y.Bat)
(Y.Bat.. Yellow letters)
Type the following next to the A> Prompt. like this:
Copy Con Y.Bat
Y.Bat
Dir
Press F6 key, then press Enter key.
-------------
└─ WRITING THE FOURTH COLOR BATCH-FILE (RB.Bat)
(RB.Bat.. Red background)
Copy Con RB.Bat
RB.Bat
Dir
Press F6 key, then press Enter key.
-------------
We'll now go to Chapter 2 and see the Color Codes
for the 8 foreground and 8 background colors.
(8 X 8 =64 possible color combinations)
-5-